package server;

import java.io.IOException;
import java.net.ServerSocket;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

public class Server {
    private int serverPort = 55555;
    private ServerSocket serverSocket;
    public static List<Connection> connections = Collections.synchronizedList(new ArrayList<Connection>());

    public Server() {
        try {
            serverSocket = new ServerSocket(serverPort);
            while (true){
                Connection connection = new Connection(this.serverSocket.accept());
                connections.add(connection);
                connection.start();
            }
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
